package cn.neusoft.annoaop;

import cn.neusoft.annoaop.IBusinessService;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class AnnoAopTest {
    //如果没有实现接口的代理类，会自动调用cglib的代理
    //实现接口的代理类，调用jdk的代理

    @Test
    public void test01(){
        ApplicationContext applicationContext =
                new ClassPathXmlApplicationContext("spring_annoaop.xml");
        IBusinessService businessService = applicationContext.getBean(IBusinessService.class);
        System.out.println(businessService.getClass());
        businessService.add();
        System.out.println("---------------------");
        businessService.update();
        System.out.println("---------------------");
        businessService.getById();

        System.out.println("====================================");
        FoodService foodService=applicationContext.getBean(FoodService.class);
        System.out.println(foodService.getClass());
        foodService.add();
        System.out.println("--------------");
        foodService.update();
        System.out.println("--------------------");
        foodService.getById();
        System.out.println("--------------------");

    }

}
